import request from '@/utils/request'

// 查询角色列表
export function listRole(query) {
  return request({
    url: '/user/sysRole/list',
    method: 'post',
    data: query
  })
}

// 查询角色详细
export function getRole(roleId) {
  return request({
    url: '/user/sysRole/list',
    method: 'post',
    data:{'roleId':roleId}
  })
}

// 新增角色
export function addRole(query) {
  return request({
    url: '/user/sysRole/save',
    method: 'post',
    data: query
  })
}

// 修改角色
export function updateRole(data) {
  
  return request({
    url: '/user/sysRole/update',
    method: 'post',
    data: data
  })
}





// 删除角色
export function delRole(roleId) {

  if(typeof roleId  === 'object'){
    roleId = roleId.toString().replace(/(\")/g, "");
  }

  return request({
    url: 'user/sysRole/delete' ,
    method: 'post',
    data:roleId
  })
}

// 导出角色
export function exportRole(query) {
  return request({
    url: 'user/sysRole/excel',
    method: 'get',
    params: query,
    responseType:"blob"
  })


}
